package com.ls.pattern.structure.composite;

import java.util.ArrayList;
import java.util.List;
//学院
public class College extends OrganizationComponent {
    List<OrganizationComponent> departmentList = new ArrayList<>();

    public College(String name, String des) {
        super(name, des);
    }

    @Override
    protected void add(OrganizationComponent organizationComponent) {
        departmentList.add(organizationComponent);
    }

    @Override
    protected void remove(OrganizationComponent organizationComponent) {
        departmentList.remove(organizationComponent);
    }
    @Override
    protected void print() {
        System.out.println("------------" + getName() + "-----------");
        for (OrganizationComponent department : departmentList) {
            department.print();
        }
    }
}
